package com.yc.chaoshi.cs_manage.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yc.chaoshi.cs_manage.DTO.AdminDTO;
import com.yc.chaoshi.entity.UmsResource;
import com.yc.chaoshi.entity.UmsUser;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface UmsUserMapper extends BaseMapper<UmsUser> {
    List<AdminDTO> listAll(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize,
                           @Param("sreachname") String sreachname, @Param("sreachrole") String sreachrole,
                           @Param("post")Integer post);
    /**
     * 获得id
     * @param umsUser
     * @return
     */
    int insertGid(UmsUser umsUser);
    @Select("select  ums_resource.*\n" +
            "from ums_resource\n" +
            "join ums_roles_resource urr on ums_resource.id = urr.resource_id\n" +
            "join ums_roles ur on ur.id = urr.roles_id\n" +
            "join ums_admin_roles uar on ur.id = uar.role_id\n" +
            "where uar.admin_id=#{id}")
    List<UmsResource> ResourceByid(Integer id);
}
